Skip to content

feat(id): refuse hosted import on CSE-choice mismatch (#3810 slice 4c) - #13313

Open
dezren39 wants to merge 1 commit into
mainfrom
lane-oc-code-02-3810-cse-parity
Open

dezren39 wants to merge 1 commit into
mainfrom
lane-oc-code-02-3810-cse-parity

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Summary

Next slice of #3810 (tracked under #2852 slice 4, spec section 6 + section 7): import verification now checks the client-side-encryption choice, and the ingest verification-token gate pins it too.

  • Fix: verify_import step 1 accepted any CSE statement that was consistently signed: a manifest claiming encryption over a plaintext-stored binding (or vice versa) verified, and ingest would store the payloads under the wrong interpretation — decrypt-wrong or downgrade opaque payloads. It now returns the new typed refusal ExportError::CseChoiceMismatch when manifest and binding record disagree (spec section 7: the flag changes only by re-encrypting via export/import, so disagreeing halves do not describe one stored data set). ingest_import refuses a verification token naming a different CSE choice before any write.
  • Tests (4 new): both mismatch directions, an unsigned flag flip (still fails as ManifestSignatureInvalid — the choice is authenticated, not decorative), and a mismatched-choice token refused pre-write with nothing landed.

Evidence

Failing-first oracle: manifest_cse_choice_mismatching_the_binding_is_refused failed on origin/main as Ok(verified…), not a compile error; passes after the fix.

cargo test -p id --lib -- hosted_export:: hosted_ingest:: hosted_binding:: on the laptop at d59896c0ff7 (post-merge with origin/main): 60 passed, 0 failed. Re-ran post-merge hosted_export:: hosted_ingest::: 21 passed, 0 failed.

Not verified here: full-workspace clippy — the shared build cache holds rustc-1.99.0 artifacts incompatible with this checkout's 1.99.1 toolchain (E0514, unrelated crates); relies on nightly CI. No new test files, so no suite-registry change.

Merge Danger

Low. Additive typed error variant + two narrow checks; no behavior change for consistent exports (all pre-existing tests pass unmodified). Adjacent-line overlap with open #13196 (same files, step-2 hunks) — semantic overlap is nil; merge order irrelevant.

Refs #3810, #2852.

{
  "direct_parent": null,
  "links": [],
  "lineage": {
    "design": null,
    "roadmap_item": null,
    "priority": null
  },
  "pm_meta": 1,
  "provenance": {
    "queue_id": null,
    "scheduled_start": null,
    "picked_up_at": null,
    "work_started_at": null,
    "created_at": "2026-11-23T13:19:51Z",
    "session_id": "ses_e5df7cef342ffeyozi9v2CbybJ",
    "lane": null,
    "host": "amd",
    "worktree": "/home/user/git/lane-oc-code-02-3810-cse-parity",
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": {
      "kind": "worktree",
      "id": "/home/user/git/lane-oc-code-02-3810-cse-parity",
      "repo": "developing-today/code",
      "branch": "lane-oc-code-02-3810-cse-parity",
      "sha": "d59896c0ff7476843101f5025063515059271b14"
    },
    "auth_subject": "oc-code-05",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

Run Proof on this PR
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

, #3810)

verify_import step 1 gains ExportError::CseChoiceMismatch: a manifest
whose client_side_encryption differs from the binding record it
travels with does not describe one stored data set (spec section 7:
the flag changes only by re-encrypting via export/import). The choice
is manifest-signed, so an unsigned flip still fails as
ManifestSignatureInvalid. ingest_import's verification-token gate now
pins the CSE choice too, refusing before any write.

Tests (failing-first: CseChoiceMismatch case failed on origin/main as
Ok/verified): both mismatch directions, unsigned flag flip,
token-with-different-choice refused pre-write.

Evidence: cargo test -p id --lib -- hosted_export:: hosted_ingest::
hosted_binding:: => 60 passed, 0 failed, on the laptop.

Refs #3810, #2852.
@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 32 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fddd0919-6a5a-455d-ac0e-533d6007faf7
Commits

Reviewing files that changed from the base of the PR and between 619b7e5 and d59896c.

Files selected for processing: 2

  • pkgs/id/src/hosted_export.rs
  • pkgs/id/src/hosted_ingest.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T13:21:46.025483Z d59896c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39

Copy link
Copy Markdown
Member Author

Filed the distinct adjacent gap as #13389: ingest compares the verified token’s binding/key/counts but does not bind its unkeyed_export trust flag to the export. The repro confirms a keyed token authorizes an unkeyed export that verify_import(..., false) refuses. This is separate from the CSE-choice mismatch addressed here.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant